package com.example.noval.db.mode

import android.text.Layout
import android.text.StaticLayout
import java.text.DecimalFormat

/**
 * @Description
 * @Author zzl
 * @Date 2024/3/29
 */ 
data class TextPage(

    var index:Int=0,
    var text:String="Loading",
    var title:String="",
    val textLines:ArrayList<TextLine> = arrayListOf(),
    var pageSize:Int=0,
    var chapterSize:Int=0,
    var chapterIndex:Int=0,
    var height: Float = 0f,
    var leftLineSize: Int = 0

){
    
    fun getLine(index: Int): TextLine {
        return textLines.getOrElse(index) {
            textLines.last()
        }
    }

    companion object {
        val readProgressFormatter = DecimalFormat("0.0%")
    }


    val lines: List<TextLine> get() = textLines
    val lineSize: Int get() = textLines.size
    val charSize: Int get() = text.length.coerceAtLeast(1)
    val searchResult = hashSetOf<TextColumn>()
    
    
    



}